package com.catfive.jet_work.viewmodel

import androidx.lifecycle.ViewModel
import com.catfive.jet_work.core.model.PanelLoginInfo
import dagger.hilt.android.lifecycle.HiltViewModel
import jakarta.inject.Inject
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow


@HiltViewModel
class NavigationViewModel @Inject constructor() : ViewModel() {
    private val _visibleItem = MutableStateFlow(true)
    val visibleItem: StateFlow<Boolean>  = _visibleItem

    private val _panelTitle = MutableStateFlow("未选择面板")
    val title: StateFlow<String> = _panelTitle

    private val _panelDomain = MutableStateFlow("请选择面板")
    val domain: StateFlow<String> = _panelDomain

    private val _paneDomainPath = MutableStateFlow("请选择面板")
    val domainPath: StateFlow<String> = _paneDomainPath

    private val _panelCertLeft = MutableStateFlow("请选择面板")
    val certLeft: StateFlow<String> = _panelCertLeft


    fun requestPanel(item:PanelLoginInfo) {
        _panelTitle.value = item.name
        _panelDomain.value = item.domain
        _visibleItem.value = true
    }


    fun selectPanel() {
        _visibleItem.value = true
    }

    fun changeVisible(){
        _visibleItem.value = !_visibleItem.value
    }

}